package jn.cdz.rabbit.mq.receiver;

import jn.cdz.rabbit.mq.entity.User;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component

public class MessageReceiver {

    @RabbitListener(queues = "hello")
    @RabbitHandler
    public void process(String hello) {
        System.out.println("Receiver  : " + hello);
    }

    @RabbitListener(queues = "topic.message")
    @RabbitHandler
    public void process1(String hello) {
        System.out.println("Receiver111111  : " + hello);
    }

    @RabbitListener(queues = "topic.message")
    @RabbitHandler
    public void process2(String hello) {
        System.out.println("Receiver222222  : " + hello);
    }

    @RabbitListener(queues = "topic.messages")
    @RabbitHandler
    public void process3(String hello) {
        System.out.println("Receiver33333  : " + hello);
    }

    @RabbitListener(queues = "topic.messages")
    @RabbitHandler
    public void process4(String hello) {
        System.out.println("Receiver4444  : " + hello);
    }

    @RabbitListener(queues = "fanout.A")
    @RabbitHandler
    public void process5(User user) {
        System.out.println("Receiver555555  : " + user);
    }

    @RabbitListener(queues = "fanout.B")
    @RabbitHandler
    public void process6(User user) {
        System.out.println("Receiver666666  : " + user);
    }

    @RabbitListener(queues = "fanout.C")
    @RabbitHandler
    public void process7(User user) {
        System.out.println("Receiver777777  : " + user);
    }
}
